﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class StartGameScene : MonoBehaviour
{
    // Start is called before the first frame update
    public Button startBtn;
    public GameObject player;
    Rigidbody2D rigidbody2D;
    void Start()
    {
        startBtn.onClick.AddListener(startGame);
        rigidbody2D = player.GetComponent<Rigidbody2D>();
        rigidbody2D.Sleep();
    }
    void startGame(){
        rigidbody2D.WakeUp();
        StartCoroutine(openMainScene());
        startBtn.gameObject.SetActive(false);
    }

    IEnumerator openMainScene(){
            yield return new WaitForSeconds(0.5f);
            SceneManager.LoadScene("Scenes/Game/MainGame");
    }
    // Update is called once per frame
    void Update()
    {
        
    }
}
